#include "d3dApp.h"
#include "Box.h"



class ColoredCubeApp : public D3DApp
{
public:
	ColoredCubeApp(HINSTANCE hInstance) : 
	  D3DApp(hInstance), mFX(0), mTech(0), mVertexLayout(0),
	  mfxWVPVar(0), mTheta(0.0f), mPhi(PI * 0.25f)
	{
		D3DXMatrixIdentity(&mView);
		D3DXMatrixIdentity(&mProj);
		D3DXMatrixIdentity(&mWVP);
	}

	virtual ~ColoredCubeApp() {
		if ( md3dDevice )
			md3dDevice->ClearState();

		ReleaseCOM(mFX);
		ReleaseCOM(mVertexLayout);
	}

	void initApp();
	void onResize();
	void updateScene(float dt);
	void drawScene();

private:
	void buildFX();
	void buildVertexLayouts();

	Box mBox;
	
	ID3D10Effect				*mFX;
	ID3D10EffectTechnique		*mTech;
	ID3D10InputLayout			*mVertexLayout;
	ID3D10EffectMatrixVariable	*mfxWVPVar;

	D3DXMATRIX mView;
	D3DXMATRIX mProj;
	D3DXMATRIX mWVP;

	float mTheta;
	float mPhi;
};
